import java.util.Iterator;
import java.util.Scanner;
import java.util.Stack;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        Stack<Character> stack = new Stack<>();
        for(int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if(stack.isEmpty()) {
                stack.push(ch);
            }else {
                char peekVal = stack.peek();
                if(peekVal == ch) {
                    stack.pop();
                }else {
                    stack.push(ch);
                }
            }
        }
        if(stack.isEmpty()) {
            System.out.println(0);
        }else {
            Iterator<Character> it = stack.iterator();
            while(it.hasNext()) {
                System.out.print(it.next());
            }
        }
    }
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int L = in.nextInt();
        int R = in.nextInt();
        int count = 0;
        for(int i = L; i <= R; i++) {
            int tmp = i;
            while(tmp != 0) {
                if(tmp % 10 == 2) {
                    count++;
                }
                tmp /= 10;
            }
        }
        System.out.print(count);
    }
}